import Vue from 'vue'
import Vuex from 'vuex'


// 全局声明
Vue.use(Vuex)


const store = new Vuex.Store({
  state:{  // 全局的数据
    count:1000,
    city:"武汉",
    msg:"太难了,我要回家找妈妈",
    flag:true

  },
  mutations:{ // 修改数据  commit 提交一下
    countAdd (state){
      state.count ++
    },
    changCity(state,payload){ // payload 是参数
      state.city = payload 
    },
    changMsg(state,payload){
      state.msg = payload
    },
    changFlag(state,payload){
      state.flag = payload
    }
    

  },
  actions:{

  },
  modules:{

  }

})


export default store